package cn.com.shadowless.xinning.view.fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import java.util.List;

import butterknife.BindView;
import cn.com.shadowless.xinning.R;
import cn.com.shadowless.xinning.model.order.CompanyBudgetOrderInfo;
import cn.com.shadowless.xinning.view.BaseFragment;

/**
 * The type Company child tab fragment.
 *
 * @author sHadowLess
 */
public class CompanyChildTabFragment extends BaseFragment {

    @BindView(R.id.main_tab)
    LinearLayout mainTab;

    private List<CompanyBudgetOrderInfo.DataBean.BudgetTypeListBean.BudgetNoDetailListBean> budgetNoDetailListBeans;

    /**
     * Instantiates a new Company child tab fragment.
     */
    public CompanyChildTabFragment(List<CompanyBudgetOrderInfo.DataBean.BudgetTypeListBean.BudgetNoDetailListBean> budgetNoDetailListBeans) {
        this.budgetNoDetailListBeans = budgetNoDetailListBeans;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_child_tab_layout;
    }

    @Override
    protected void initData() {
        for (CompanyBudgetOrderInfo.DataBean.BudgetTypeListBean.BudgetNoDetailListBean budgetNoDetailListBean : budgetNoDetailListBeans) {
            View childView = LayoutInflater.from(mActivity).inflate(R.layout.fragment_child_tab_item, null, false);
            LinearLayout childTab = childView.findViewById(R.id.company_child_tab_item);
            TextView childTabTitle = childView.findViewById(R.id.child_tab_title);
            TextView companyChildTabProject = childView.findViewById(R.id.company_child_tab_project);
            TextView companyChildTabBudgetStatus = childView.findViewById(R.id.company_child_tab_budgetStatus);
            TextView companyChildTabOne = childView.findViewById(R.id.company_child_tab_one);
            TextView companyChildTabTwo = childView.findViewById(R.id.company_child_tab_two);
            TextView companyChildTabThree = childView.findViewById(R.id.company_child_tab_three);
            TextView companyChildTabFour = childView.findViewById(R.id.company_child_tab_four);
            TextView companyChildTabFive = childView.findViewById(R.id.company_child_tab_five);
            TextView companyChildTabSix = childView.findViewById(R.id.company_child_tab_six);
            TextView companyChildTabSeven = childView.findViewById(R.id.company_child_tab_seven);
            TextView companyChildTabEight = childView.findViewById(R.id.company_child_tab_eight);
            TextView companyChildTabNine = childView.findViewById(R.id.company_child_tab_nine);
            TextView companyChildTabTen = childView.findViewById(R.id.company_child_tab_ten);
            TextView companyChildTabEleven = childView.findViewById(R.id.company_child_tab_eleven);
            TextView companyChildTabTwelve = childView.findViewById(R.id.company_child_tab_twelve);
            TextView companyChildTabSum = childView.findViewById(R.id.company_child_tab_Sum);
            TextView companyChildTabBudget = childView.findViewById(R.id.company_child_tab_Budget);

            String budgetTypeName = budgetNoDetailListBean.getBudgetTypeName();
            String budgetTypeRemark = budgetNoDetailListBean.getBudgetTypeRemark();
            String january = getDecimal(budgetNoDetailListBean.getJanuary().doubleValue());
            String february = getDecimal(budgetNoDetailListBean.getFebruary().doubleValue());
            String march = getDecimal(budgetNoDetailListBean.getMarch().doubleValue());
            String april = getDecimal(budgetNoDetailListBean.getApril().doubleValue());
            String may = getDecimal(budgetNoDetailListBean.getMay().doubleValue());
            String june = getDecimal(budgetNoDetailListBean.getJune().doubleValue());
            String july = getDecimal(budgetNoDetailListBean.getJuly().doubleValue());
            String august = getDecimal(budgetNoDetailListBean.getAugust().doubleValue());
            String september = getDecimal(budgetNoDetailListBean.getSeptember().doubleValue());
            String october = getDecimal(budgetNoDetailListBean.getOctober().doubleValue());
            String november = getDecimal(budgetNoDetailListBean.getNovember().doubleValue());
            String december = getDecimal(budgetNoDetailListBean.getDecember().doubleValue());
            String totalBudget = getDecimal(budgetNoDetailListBean.getTotalBudget().doubleValue());
            String remark = budgetNoDetailListBean.getRemark();
            childTabTitle.setText(budgetTypeName);
            companyChildTabProject.setText(budgetTypeName);
            companyChildTabBudgetStatus.setText(budgetTypeRemark);
            companyChildTabOne.setText(january);
            companyChildTabTwo.setText(february);
            companyChildTabThree.setText(march);
            companyChildTabFour.setText(april);
            companyChildTabFive.setText(may);
            companyChildTabSix.setText(june);
            companyChildTabSeven.setText(july);
            companyChildTabEight.setText(august);
            companyChildTabNine.setText(september);
            companyChildTabTen.setText(october);
            companyChildTabEleven.setText(november);
            companyChildTabTwelve.setText(december);
            companyChildTabSum.setText(totalBudget);
            companyChildTabBudget.setText(remark);
            mainTab.addView(childTab);
        }
    }

    @Override
    protected void initView() {

    }
}
